/**********************************************************/
/* Goblin Defense - A tower defense game for Wii Homebrew */
/* Copyright (C) 2009 Ricardo Bueno Cordeiro              */
/* Licensed under de GNU General Public License v2.0      */
/*   See license_gplv2.txt for detalis                    */
/**********************************************************/

#include <gccore.h>
#include <wiiuse/wpad.h>

#include "draw.h"
#include "control.h"

int Control::update(int state, u32 step, WPADData *wiimote_data) {
	if (wiimote_data->btns_d & WPAD_BUTTON_HOME)
		return 1;

	if (wiimote_data->btns_d & WPAD_BUTTON_1)
		this->game.start_game(0);

	this->game.update(state, step, wiimote_data);
		
	return 0;
}

void Control::draw(int state) {
	DR_configure(DRAW_CONF_DRAW_TEXTURE);
	this->game.draw(CONTROL_FOREGROUND);
}

void Control::text(int state) {
	DR_configure(DRAW_CONF_TEXT);
	this->game.text(CONTROL_FOREGROUND);
}
